package com.zhuhjay.eduservice.controller;


import com.zhuhjay.commonutils.R;
import com.zhuhjay.eduservice.entity.EduVideo;
import com.zhuhjay.eduservice.service.EduVideoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 课程视频 前端控制器
 * </p>
 *
 * @author ZhuHJay
 * @since 2022-09-06
 */
@Api(description = "课程视频控制器")
@RestController
@RequestMapping("/eduservice/video")

public class EduVideoController {

    @Resource
    private EduVideoService videoService;

    @ApiOperation(value = "添加小节信息（视频）")
    @PostMapping("addVideo")
    public R addVideo(@RequestBody EduVideo video) {
        videoService.save(video);
        return R.ok();
    }

    @ApiOperation(value = "修改小节信息（视频）")
    @PostMapping("updateVideo")
    public R updateVideo(@RequestBody EduVideo video) {
        videoService.updateById(video);
        return R.ok();
    }

    @ApiOperation(value = "删除小节信息（视频）")
    @DeleteMapping("{id}")
    public R deleteVideo(@PathVariable String id) {
        videoService.removeById(id);
        return R.ok();
    }

}

